package org.finesys.chat.core.base.embedding.store.milvus;

import org.springframework.util.StringUtils;

public class FieldDefinition {

    private static final String DEFAULT_ID_FIELD_NAME = "id";
    private static final String DEFAULT_TEXT_FIELD_NAME = "text";
    private static final String DEFAULT_METADATA_FIELD_NAME = "metadata";
    private static final String DEFAULT_VECTOR_FIELD_NAME = "vector";

    private final String idFieldName;
    private final String textFieldName;
    private final String metadataFieldName;
    private final String vectorFieldName;

    public FieldDefinition(String idFieldName, String textFieldName, String metadataFieldName, String vectorFieldName) {
        if(!StringUtils.hasText(idFieldName)){
            idFieldName=DEFAULT_ID_FIELD_NAME;
        }
        if(!StringUtils.hasText(textFieldName)){
            textFieldName=DEFAULT_TEXT_FIELD_NAME;
        }
        if(!StringUtils.hasText(metadataFieldName)){
            metadataFieldName=DEFAULT_METADATA_FIELD_NAME;
        }
        if(!StringUtils.hasText(vectorFieldName)){
            vectorFieldName=DEFAULT_VECTOR_FIELD_NAME;
        }
        this.idFieldName = idFieldName;
        this.textFieldName = textFieldName;
        this.metadataFieldName = metadataFieldName;
        this.vectorFieldName = vectorFieldName;
    }

    public String getIdFieldName() {
        return idFieldName;
    }

    public String getTextFieldName() {
        return textFieldName;
    }

    public String getMetadataFieldName() {
        return metadataFieldName;
    }

    public String getVectorFieldName() {
        return vectorFieldName;
    }
}
